package top.wilsonlv.jaguar.cloud.upms.sdk.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import top.wilsonlv.jaguar.cloud.upms.sdk.dto.DeviceBindDTO;
import top.wilsonlv.jaguar.cloud.upms.sdk.vo.DeviceVO;
import top.wilsonlv.jaguar.commons.web.response.JsonResult;

import javax.validation.Valid;

/**
 * @author lvws
 * @since 2022/3/29 0029
 */
@FeignClient(value = "jaguar-upms-server", contextId = "remoteDeviceService")
public interface RemoteDeviceService {

    /**
     * 根据设备UID查询设备
     *
     * @param deviceUid 设备UID
     * @return 设备
     */
    @GetMapping("/feign/device/loadDevice")
    JsonResult<DeviceVO> loadDevice(@RequestParam("deviceUid") String deviceUid);

    /**
     * 根据设备UID查询设备
     *
     * @param userId   用户ID
     * @param deviceIp 设备IP
     * @param bindDTO  设备信息
     * @return 设备
     */
    @PostMapping("/feign/device/bindDevice")
    JsonResult<Void> bindDevice(@RequestParam("userId") Long userId,
                                @RequestParam("deviceIp") String deviceIp,
                                @Valid @RequestBody DeviceBindDTO bindDTO);


}
